/**
 * 用户相关的请求模块
 */
import request from "@/utils/request"
/**
 * 用户登录
 */
export const login = data => {
        return request({
            method: 'POST',
            url: '/v1_0/authorizations',
            data
        })
    }
    //  获取验证码的接口
export const getSmsCode = mobile => {
        return request({
            url: `/v1_0/sms/codes/${mobile}`
        })
    }
    //  获取用户自己信息的接口
export const getUserInfo = () => {
        return request({
            url: `/v1_0/user`
        })
    }
    /**
     * 获取用频道列表
     */
export const getUserChannels = () => {
    return request({
        url: '/v1_0/user/channels'
    })
}
/**
 * 添加关注
 */
 export const addFollow = userId => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}

/**
 * 取消关注
 */
export const deleteFollow = userId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${userId}`
  })
}
// 获取个人资料
export const getUserProfile = target => {
  return request({
    url: `/v1_0/user/profile`
  })
}
// 更新个人资料
export const updateUserProfile = data => {
  return request({
    method: 'PATCH',
    url: `/v1_0/user/profile`,
    data
  })
}
/**
 * 更新用户头像
 */
  export const updateUserPhoto = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data
  })
}
